package co.fitstart.weapp.api.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * 课程预约工具类
 * @author haiyan_xiao
 *
 */
public class CourseAppointmentUtils {

    /**
     * 获取当前日期为周几
     * @param day
     * @return 1 周一,2 周二,3 周三,4 周四,5 周五, 6 周六,7 周日
     */
    public static int getDayOfWeek(Date day) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(day);
        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
        
        if(dayOfWeek == 1) {
            return 7;
        } else {
            return dayOfWeek -1;
        }
    }
}
